package com.webchat.connect.controller;

import com.webchat.common.bean.APIResponseBean;
import com.webchat.common.bean.APIResponseBeanUtil;
import com.webchat.common.util.JsonUtil;
import com.webchat.connect.messagequeue.consumer.service.ChatMessageConsumeService;
import com.webchat.domain.vo.request.mess.ChatMessageRequestVO;
import com.webchat.rmi.connect.ConnectServiceClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ConnectServiceController implements ConnectServiceClient {


    @Autowired
    private ChatMessageConsumeService chatMessageConsumeService;

    @Override
    public APIResponseBean<Boolean> doSend(@RequestBody ChatMessageRequestVO messageRequestVO) {
        chatMessageConsumeService.handleChatMessage(JsonUtil.toJsonString(messageRequestVO));
        return APIResponseBeanUtil.success(true);
    }
}
